-- GENERATED SPELL FOR [Tomb Horror] --


function spell0_15979(pUnit, Event) --@Crypt Scarab Swarm,Self--
pUnit:FullCastSpellOnTarget(54313,pUnit)
pUnit:RegisterEvent('Sorts_15979', 3000, 1)
end

function spell1_15979(pUnit, Event) --@Crypt Scarab Swarm,Self--
pUnit:FullCastSpellOnTarget(54317,pUnit)
pUnit:RegisterEvent('Sorts_15979', 3000, 1)
end

function spell2_15979(pUnit, Event) --@Crypt Scarabs,n/a--
pUnit:FullCastSpellOnTarget(54311,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_15979', 2000, 1)
end

function spell3_15979(pUnit, Event) --@Crypt Scarabs,n/a--
pUnit:FullCastSpellOnTarget(54316,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_15979', 1500, 1)
end

function Sorts_15979(pUnit, Event)
local choix_sorts_15979 = math.random(0, 3)
if choix_sorts_15979 == 0 then
pUnit:RegisterEvent('spell0_15979', 1, 1)
end
if choix_sorts_15979 == 1 then
pUnit:RegisterEvent('spell1_15979', 1, 1)
end
if choix_sorts_15979 == 2 then
pUnit:RegisterEvent('spell2_15979', 1, 1)
end
if choix_sorts_15979 == 3 then
pUnit:RegisterEvent('spell3_15979', 1, 1)
end
end

function mob15979_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_15979', math.random(1500, 3000), 1)
end

function mob15979_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob15979_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob15979_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(15979, 1, 'mob15979_Action')
RegisterUnitEvent(15979, 2, 'mob15979_Leave')
RegisterUnitEvent(15979, 3, 'mob15979_Kill')
RegisterUnitEvent(15979, 4, 'mob15979_Die')
